<?php

class marque_model extends CI_Model{
    
    public function __construct(){
        parent::__construct(); 
        $this->load->database();
        
   }
   
    public function getPartenaireMarque($id_user){
       
       $this->db->select('marque.marque,marque.description');
       $this->db->from('partenaire_has_marque');
       $this->db->join('marque', 'marque.id = partenaire_has_marque.marque_id');
       $this->db->join('partenaire', 'partenaire_has_marque.partenaire_id = partenaire.id');
       $this->db->where('partenaire.user_id',$id_user); 
       $query = $this->db->get();
        
        if ($query->num_rows() > 0) {
            foreach ($query->result() as $row) {
                $data[] = $row;
            }
             return $data;
        }
        else
        {
            return false;
        }
   }
}
   
   ?>